﻿/*****************************************
 * 
 *  copyright (c) by ylshen
 * 
 *  author : ylshen (syl.lucky@gmail.com)
 *  
 **************************************** */

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace JYStockAnalyser.Model
{
    /// <summary>
    /// 股票
    /// </summary>
    [Serializable]
    public class Stock
    {
        string m_no;
        string m_name;     
        string m_companyName;

        string m_province;        
        string m_trade;
        string m_address;
        string m_location;
        int m_kind;

        /// <summary>
        /// 编号
        /// </summary>
        public string NO
        {
            get { return m_no; }
            set { m_no = value; }
        }
        /// <summary>
        /// 股票种类 (1 金融类　2　非金融类)
        /// </summary>
        public int Kind
        {
            get { return m_kind; }
            set { m_kind = value; }
        }
        /// <summary>
        /// 股票名称
        /// </summary>
        public string Name
        {
            get { return m_name; }
            set { m_name = value; }
        }
        /// <summary>
        /// 上市公司名称
        /// </summary>
        public string CompanyName
        {
            get { return m_companyName; }
            set { m_companyName = value; }
        }
        /// <summary>
        /// 省份
        /// </summary>
        public string Province
        {
            get { return m_province; }
            set { m_province = value; }
        }
        /// <summary>
        /// 行业
        /// </summary>
        public string Trade
        {
            get { return m_trade; }
            set { m_trade = value; }
        }  
        /// <summary>
        /// 地址
        /// </summary>
        public string address
        {
            get { return m_address; }
            set { m_address = value; }
        }
        /// <summary>
        /// 上市地点
        /// </summary>
        public string Location
        {
            get { return m_location; }
            set { m_location = value; }
        }

        /// <summary>
        /// 根据股票名称获取股票类别
        /// </summary>
        /// <param name="stockName"></param>
        /// <returns></returns>
        public static int GetKind(string stockName)
        {
            if (stockName.IndexOf("(金融)") == -1)
            {
                //非金融
                return 2;
            }
            else
            {
                //金融
                return 1;
            }
        }

        public override string ToString()
        {
            return ToShowString();
        }

        /// <summary>
        /// 显示为编号+名称+类型的字符串
        /// </summary>
        /// <returns></returns>
        public string ToShowString()
        {
            return string.Format("{0} {1}", NO, Name);            
        }
    }
}
